<template>
    <el-form-item class="collapse-link">
        <el-link :underline="false" size="mini" @click="toggle">
            {{ this.$store.state.searchCollapse ? "默认搜索" : "高级搜索"}}
            <i :class="this.$store.state.searchCollapse ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
        </el-link>
    </el-form-item>
</template>

<script>
    export default {
        name: "collapseLink",
        methods: {
            // 改变高级搜索条件折叠状态
            toggle() {
                this.$store.commit('changeSearchCollapse', !this.$store.state.searchCollapse);
            }
        },
        mounted() {
            // 加载组件时初始化高级搜索条件折叠状态
            this.$store.commit('changeSearchCollapse', false);
        }
    }
</script>

<style lang="less" scoped>
    .collapse-link {
        // 防止双击会选中文本出现蓝色背景
        user-select: none;
    }
</style>
